<?php

namespace app\common\service;

use app\common\model\OrderCommon;
use app\common\model\Users;

class H5Service extends PlatformBaseService
{
    public $platform = PlatFormFactory::H5;
    public function __construct()
    {
        parent::__construct();
    }

    public function relationThird(Users $users, string $type = 'register')
    {

    }

    /**
     * @param \app\common\model\OrderCommon $orderCommon
     * @return array|string
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \GuzzleHttp\Exception\GuzzleException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function createOrder(OrderCommon $orderCommon)
    {
        return (new WechatOfficialService())->createOrder($orderCommon, 'MWEB');
    }


    /**
     * @param \app\common\model\OrderCommon $model
     * @return void
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function refundOrder(OrderCommon $model)
    {
        (new WechatService())->refundOrder($model);
    }
}